package com.biz.primus.model.customercenter.vo.request;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

import java.io.Serializable;

/**
 * 分页请求对象
 * @author jun.liu
 * @date 2017年11月15日
 * @reviewer
 * @see
 */
@ApiModel(description = "分页请求对象")
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class PageRequestVo<T> implements Serializable
{

	private static final long serialVersionUID = 1930169601015904079L;

	/**
	 * 当前page
	 */
	@ApiModelProperty(value = "当前page", name = "page", example = "0")
	private Integer page = 0;

	@ApiModelProperty(value = "默认为每页10条", name = "size", example = "10")
	private Integer size = 10;

	public Pageable toPageable() {
		return new PageRequest(page, size);
	}
}
